# 生成各种表单的id
import time
import datetime
import random

def get_id(prefix):
    # 输入前缀，例: 'HX'
    my_id = ''

    timeid = str(datetime.datetime.now())[2:10].replace('-', '')
    ss = str(int(time.time()*1000))[-4:]
    ran = '%04d' % (random.randint(1,9999))
    my_id = prefix + timeid + ss + ran

    return my_id



# 唯一性测试
# a = set((get_id('a') for x in range(100)))
# print(len(a))
